class CartesianProduct
  include Enumerable
  attr_accessor :res
  def initialize(a, b)
	@res = []
	a.each {|x| b.each {|y| @res.push([x, y])}}
	@res
  end
  def each
      for i in 0...@res.length
		yield @res[i]
      end
	#@res.each(|x| yield(x))
  end
  # your code here
end

c = CartesianProduct.new([:a,:b], [4,5])
c.each { |elt| puts elt.inspect }

#=> "[:a, 4][:a, 5][:b, 4][:b, 5]"